/***************************************************************************
 *   Copyleft 2008-2009 by												   *
 *	 Iwanicki Krzysztof													   *
 *   <gamma.mini.pw.edu.pl/~iwanickik>									   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 ***************************************************************************/
#include "./vAbstractDialog.h"
#include <stdio.h>

namespace Vendetta {
	vAbstractDialog::vAbstractDialog(HWND hWndOwner) {
		mhOwner = hWndOwner ;
	}

	/**************************************************************
	* Other helpfull functions                                    *
	***************************************************************/
	vReal vAbstractDialog::DlgItemFloat(HWND hDlg, vInt id) {
		vTChar *pEnd;
		vTChar szItemText [50];

		::GetDlgItemText(hDlg, id, (vTChar*) szItemText, 20);

		return (vReal) strtod((vChar*) szItemText, (vChar**) &pEnd);
	}

	vInt vAbstractDialog::DlgItemInt(HWND hDlg, vInt id) {
		vInt bRet;

		return (vInt) ::GetDlgItemInt(hDlg, id, &bRet, true);
	}

	vVoid vAbstractDialog::SetDlgItemFloat(HWND hDlg, vInt id, vReal val) {
		vTChar szItemText [50];

		sprintf_s((vChar*) szItemText, 50, "%f", val);

		::SetDlgItemText(hDlg, id, szItemText) ;
	}

	vVoid vAbstractDialog::SetDlgItemInt(HWND hDlg, vInt id, vInt val) {
		::SetDlgItemInt(hDlg, id, val, TRUE) ;
	}
}